package com.sairobo.admin.modules.srblive.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sairobo.base.common.entity.Page;
import com.sairobo.base.common.entity.Query;
import com.sairobo.base.common.entity.R;
import com.sairobo.base.common.utils.CommonUtils;
import com.sairobo.admin.modules.srblive.entity.SrbliveNews;
import com.sairobo.admin.modules.srblive.manager.SrbliveNewsManager;
import com.sairobo.admin.modules.srblive.service.SrbliveNewsService;

/**
 * 客服消息表
 *
 * @author admin
 * @email sairobo
 * @url www.sairobo.com
 * @date 2018年1月11日 下午2:12:02
 */
@Service("srbliveNewsService")
public class SrbliveNewsServiceImpl implements SrbliveNewsService {

	@Autowired
	private SrbliveNewsManager srbliveNewsManager;

	@Override
	public Page<SrbliveNews> listSrbliveNews(Map<String, Object> params) {
		Query query = new Query(params);
		Page<SrbliveNews> page = new Page<>(query);
		srbliveNewsManager.listSrbliveNews(page, query);
		return page;
	}

	@Override
	public R saveSrbliveNews(SrbliveNews role) {
		int count = srbliveNewsManager.saveSrbliveNews(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getSrbliveNewsById(Long id) {
		SrbliveNews srbliveNews = srbliveNewsManager.getSrbliveNewsById(id);
		return CommonUtils.msg(srbliveNews);
	}

	@Override
	public R updateSrbliveNews(SrbliveNews srbliveNews) {
		int count = srbliveNewsManager.updateSrbliveNews(srbliveNews);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = srbliveNewsManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
